<template>
    <div>
        <input type="text" v-model="inputVal" @keyup.enter='addTask'>
        <ul>
            <li v-for="(item,index) in taskList" :key="index">{{item}}</li>
        </ul>
    </div>
</template>

<script lang="ts">
import {ref,computed} from "vue"
import {useStore} from "vuex"
export default {
    name: "todo",
    setup(){
        const store = useStore()
        const taskList = computed(()=>store.state.taskList)
        const inputVal = ref("")

        const addTask = () => {
            store.commit("createTask",inputVal.value)
            inputVal.value = ''
        }

        return {inputVal,taskList,addTask}
    },
    components: {},
};
</script>

<style lang="scss">
   
</style>
